//jQuery页面加载事件
$(document).ready(function(){
	//alert("加载成功！");
})

var path = "${pageContext.request.contextPath }";

//获取客户的车辆信息
function getCar(){
	var customer = document.getElementById("customer").value;
	var carinfo;
	
	$.ajax({
   		type: "POST",									//请求方式
   		url: path + "/car/Car_seletecarbycid",			//地址
   		data: {cidc:customer},							//传递的参数
   		success: function(data){						//回调函数返回的结果
			$("#cidb").empty();
			for(var i=0; i<data.length; i++){
				carinfo = data[i].split('-');
				var html = $("<option value='"+carinfo[0]+"'>"+carinfo[1]+"</option>");
				$("#cidb").append(html);
			}
   		}
	});
}

//查询客户是否存在
function customerExits(){
	var cida = document.getElementById("cida").value;
	
	$.ajax({
   		type: "POST",									//请求方式
   		url: path + "/customer/Customer_customerexits",	//地址
   		data: {cid:cida},								//传递的参数
   		success: function(date){						//回调函数返回的结果		
			$("#usernamemsg").val(date);		
   		}
	});
}

//判断原密码
function oldpwd(){
	var oldpwd = document.getElementById("oldpwd");
	
	$.ajax({
   		type: "POST",									//请求方式
   		url: path + "/manager/Manager_uppwdcheck",		//地址
   		data: "oldpwd=" + oldpwd.value + "",			//传递的参数
   		success: function(date){						//回调函数返回的结果	
			if(date == "false"){
				oldpwd.style.border = "1px solid";
				oldpwd.style.borderColor = "red";	
				$("#oldpwdmsg").html("原密码错误！请你重新输入");
				return false;
			}else{
				oldpwd.style.border = "";
				$("#oldpwdmsg").html("<font color='green' size='2px'>√</font>");
				return true;
			}			
   		}
	});
}